<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>本店预约列表</title>
	<link type="text/css" rel="stylesheet" href="/fontsawesome/css/font-awesome.css"/>
	<link type="text/css" rel="stylesheet" href="/css/datepicker.css"/>
	<link type="text/css" rel="stylesheet" href="/css/style.css"/>
	<link type="text/css" rel="stylesheet" href="/css/demo.css"/>

	<style>

		.title_top span h1{
			margin: 13px;
			color: #e8262e;
		}
		.titlebtn_box {
			padding:15px 0;
			border-bottom: 1px dashed #ddd;
		}
		.dbb {
			position: relative;
			left: -350px;
		}
		.size{
			width: 40%;
		}
	</style>
</head>
<body>
<div class="main_box">
	<h2 th:text="|${names} >>> 商品预览|"></h2>
	<form method="post" id="type_form">
		<div class="search_box clearfix">
			<label>商品类型：</label>
			<select name="typeId">
				<option value="0">所有类型</option>
				<option th:each="t,line : ${#session.getAttribute('typeList')}" th:value="${t?.id}"
						th:text="${t?.stateName}" th:selected="${t?.id == typeId}"></option>
			</select>
			<label>商品状态：</label>
			<select name="state">
				<option value="2" th:selected="${state == '2'}">全部状态</option>
				<option value="1" th:selected="${state == '1'}">活动商品</option>
				<option value="0" th:selected="${state == '0'}">普通商品</option>
			</select>

			<input type="button" value="搜索" class="btn blue_btn"/>
			<input type="button" value="设置折扣" class="btn blue_btn set"/>
		</div>
	</form>
	<div class="cont_box">
		<table border="0" cellspacing="0" cellpadding="0" class="table" id="table_box">
			<thead>
			<tr>
				<th>商品名称</th>
				<th>商品类型</th>
				<th>库存数量</th>
				<th>进货价格</th>
				<th>零售价</th>
				<th>折扣价</th>
				<th>商品状态</th>
			</tr>
			</thead>
			<tbody>
			<tr th:each="t,line : ${paMar?.items}"><!--此处id为进行编辑或删除时该条数据的唯一标识-->
				<td th:text="${t?.commodity.name}"></td>
				<td th:text="${t?.commodity.commodityType.stateName}"></td>
				<td th:text="${t?.amount}"></td>
				<td th:text="${t?.commodity.price}"></td>
				<td th:text="${t?.price}"></td>
				<td th:text="${t?.discountPrice}"></td>
				<td th:text="${t?.state == 0?'普通商品':'活动商品'}"></td>
			</tr>
			</tbody>
		</table>
	</div>
	<div class="page-bar titlebtn_box">
		<ul class="page-num-ul clearfix">
			<li th:object="${paMar}">&nbsp;&nbsp;
				<span th:text="|共*{count}条记录|"></span>&nbsp;&nbsp;
				<span th:text="|第*{curr}页 / 共*{total}页|"></span>
			</li>&nbsp;&nbsp;&nbsp;

			<a href="javascript:void(0)" title="首页">
				<i class="fa fa-arrow-circle-o-up"></i>
			</a>&nbsp;
			<a href="javascript:void(0)" title="上一页">
				<i class="fa fa-arrow-circle-o-left"></i>
			</a>&nbsp;
			<a href="javascript:void(0)" title="下一页">
				<i class="fa fa-arrow-circle-o-right"></i>
			</a>&nbsp;
			<a href="javascript:void(0)" title="尾页">
				<i class="fa fa-arrow-circle-o-down"></i>
			</a>
		</ul>
	</div>


</div>
</div>
<!--javascript include-->
<script src="/js/jquery-2.2.1.min.js"></script>
<script src="/js/jquery.dataTables.min.js"></script>
<script src="/js/bootstrap-datepicker.js"></script>
<script src="/js/jquery.validate.min.js"></script>
<script src="/js/other.js"></script>

<!-- 分页和条件查询 -->
<script type="text/javascript" th:inline="javascript">
	var curr = [[${paMar?.curr ?: 1}]];
	var total = [[${paMar?.total ?: 0}]];

	if (total == 0){
		$(".page-num-ul a").hide();
	}
	//判断, 是否是第一页
	if(curr == 1){
		$(".page-num-ul a:lt(2)").hide();
	}
	//判断, 是否是最后一页
	if(curr == total){
		$(".page-num-ul a:gt(1)").hide();
	}
	$(".page-num-ul a:eq(0)").bind("click", function() {
		toJump1("/activationRecord/activity", $("#type_form").serialize() + "&curr=1&choose=[[${#session.getAttribute('choose')}]]");
	});
	$(".page-num-ul a:eq(1)").bind("click", function() {
		toJump1("/activationRecord/activity", $("#type_form").serialize() + "&curr=[[${paMar.curr-1}]]&choose=[[${#session.getAttribute('choose')}]]");
	});
	$(".page-num-ul a:eq(2)").bind("click", function() {
		toJump1("/activationRecord/activity", $("#type_form").serialize() + "&curr=[[${paMar.curr+1}]]&choose=[[${#session.getAttribute('choose')}]]");
	});
	$(".page-num-ul a:eq(3)").bind("click", function() {
		toJump1("/activationRecord/activity", $("#type_form").serialize() + "&curr=[[${paMar.total}]]&choose=[[${#session.getAttribute('choose')}]]");
	});

	$(":button[value='搜索']").bind("click",function () {
		toJump1("/activationRecord/activity",$("#type_form").serialize() + "&choose=[[${#session.getAttribute('choose')}]]");
	})
</script>

<script>

	$(function(){
		$("body").tipWindow({method:"edit",Class:".set",even:"click",
			Twidth:"600",Theight:"350",tipTit:"折扣设定",editUrl:"/activationRecord/discount"});
	});
</script>

</body>
</html>
